from time import sleep

from selenium.webdriver.common.by import By

from base.base_page import BasePage
from selenium.webdriver.remote.webdriver import WebDriver


class HomePage(BasePage):
    base_url = "https://www.baidu.com/"
    login_icon = 'xpath', '//*[@id="u1"]/a'
    account = 'id', 'TANGRAM__PSP_11__footerULoginBtn'
    username = 'id', 'TANGRAM__PSP_11__userName'
    password = 'id', 'TANGRAM__PSP_11__password'

    def login(self, username, password):
        self.click_ele(self.login_icon)
        sleep(2)
        self.click_ele(self.account)
        sleep(2)
        self.send_ele(self.username, username)
        sleep(2)
        self.send_ele(self.password, password)
        sleep(2)
